#include "librarymanagment.h"
#include "ui_librarymanagment.h"
#include <QString>
#include <QMessageBox>
#include <QPalette>


libraryManagment::libraryManagment(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::libraryManagment)
{
    ui->setupUi(this);

    //QPixmap pixmap = QPixmap("D://Qt//workspace//bookManager//pictures//xiyang.jpg").scaled(this->size());
    QPixmap pixmap = QPixmap("D://CsSoftware//Qt//__MyFiles//workspace//bookManager//pictures//flower.jpg").scaled(this->size());
    QPalette palette(this->palette());
    palette.setBrush(QPalette::Background,pixmap);
    this->setPalette(palette);

}

libraryManagment::~libraryManagment()
{
    delete ui;
}

void libraryManagment::on_pushButton_clicked()
{
    QString input = this->ui->le_libraryInput->text();
    int in = input.toInt();

    if(in < 1 || in > 5)
    {
        QMessageBox::critical(this,"错误","请输入1-5之间的数字！","确定");
    }else{
    switch (in) {
    case 1:
        this->a.show();
        break;
    case 2:
        QMessageBox::question(this,"询问","是否想添加图书？","确定");
        this->b.show();
        break;
    case 3:
        this->c.show();
        break;
    case 4:
        this->d.show();
        break;
    case 5:
        this->e.show();
        break;
    default:
        break;
    }
    }
}

void libraryManagment::on_pushButton_2_clicked()
{
    this->close();
}
